<?php
/**
 * Created by PhpStorm.
 * User: lxq
 * Date: 2018/3/16
 * Time: 18:22
 */
class  spec_imagesModel  extends  Model{

    public function __construct()
    {
        parent::__construct('spec_images');
    }

    /**
     * 获取一条记录的详细信息
     * @param array $condition
     * @param string $field
     * @return mixed
     */
    public function getSpecImageInfo($condition = array(), $field = '*')
    {
        return $this->field($field)->where($condition)->find();
    }

    /**
     * 插入一条记录
     * @param array $params
     * @return mixed
     */
    public function addSpecImage($params)
    {
        return $this->insert($params);
    }

    /**
     * 修改记录
     * @param array $condition
     * @param array $params
     * @return mixed
     */
    public function updateSpecImage($condition,$params)
    {
        return $this->where($condition)->update($params);
    }

    /**
     * 删除记录
     * @param array $condition
     * @return mixed
     */
    public function delSpecImage($condition)
    {
        //逻辑删除
        return $this->updateSpecImage($condition, array('img_deleted'=>1));
    }

    /**
     * 获取记录数组
     * @param array $condition
     * @param string $field
     * @param string $order
     * @return mixed
     */
    public function getSpecImageList($condition = array(), $field = '*', $order = 'img_id'){
        return $this->field($field)->where($condition)->order($order)->select();
    }

    /**
     * 统计
     * @param array $condition
     */
    public function getSpecImageCount($condition)
    {
        return $this->where($condition)->count();
    }

}